/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dchapman
 */
@Entity
@Table(name = "MaltNotes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MaltNotes.findAll", query = "SELECT m FROM MaltNotes m"),
    @NamedQuery(name = "MaltNotes.findByMaltNoteID", query = "SELECT m FROM MaltNotes m WHERE m.maltNoteID = :maltNoteID"),
    @NamedQuery(name = "MaltNotes.findByMaltNoteLbs", query = "SELECT m FROM MaltNotes m WHERE m.maltNoteLbs = :maltNoteLbs")})
public class MaltNotes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "maltNoteID")
    private Integer maltNoteID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "maltNoteLbs")
    private float maltNoteLbs;
    @JoinColumn(name = "maltID", referencedColumnName = "MaltID", nullable=true)
    @ManyToOne(optional = true)
    private Malt maltID;

    public MaltNotes() {
    }

    public MaltNotes(Integer maltNoteID) {
        this.maltNoteID = maltNoteID;
    }

    public MaltNotes(Integer maltNoteID, float maltNoteLbs) {
        this.maltNoteID = maltNoteID;
        this.maltNoteLbs = maltNoteLbs;
    }

    public Integer getMaltNoteID() {
        return maltNoteID;
    }

    public void setMaltNoteID(Integer maltNoteID) {
        this.maltNoteID = maltNoteID;
    }

    public float getMaltNoteLbs() {
        return maltNoteLbs;
    }

    public void setMaltNoteLbs(float maltNoteLbs) {
        this.maltNoteLbs = maltNoteLbs;
    }

    public Malt getMaltID() {
        return maltID;
    }

    public void setMaltID(Malt maltID) {
        this.maltID = maltID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (maltNoteID != null ? maltNoteID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MaltNotes)) {
            return false;
        }
        MaltNotes other = (MaltNotes) object;
        if ((this.maltNoteID == null && other.maltNoteID != null) || (this.maltNoteID != null && !this.maltNoteID.equals(other.maltNoteID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.MaltNotes[ maltNoteID=" + maltNoteID + " ]";
    }
    
}
